﻿using AmiDraw.Lib.Models;
using PropertyChanged;
using System.Drawing;

namespace AmiDraw.Lib
{
    [AddINotifyPropertyChangedInterface]
    public class RectangleElement : MultiplotElemtentBase
    {
        public override string Name => "Rectangle";

        public override string Description => "绘制一个块元素";

        public string Color { get; set; } = "White";


        public override void Draw(Graphics graphics, string packName, ResultQueryMode mode = ResultQueryMode.Core)
        {
            var brush = new SolidBrush((Color)new ColorConverter().ConvertFromString(Color));
            var rect = new RectangleF((float)X, (float)Y, (float)Height, (float)Width);
            graphics.FillRectangle(brush, rect);
        }
    }

    [AddINotifyPropertyChangedInterface]
    public class TextElement : MultiplotElemtentBase
    {
        public override string Name => "Text";

        public override string Description => "绘制一个文本元素";

        public string Color { get; set; } = "Black";
        public string Text { get; set; } = "文本元素";


        public override void Draw(Graphics graphics, string packName, ResultQueryMode mode = ResultQueryMode.Core)
        {
            var brush = new SolidBrush((Color)new ColorConverter().ConvertFromString(Color));
            var rect = new RectangleF((float)X, (float)Y, (float)Height, (float)Width);
            var font = new Font("Arial", 16);
            graphics.DrawString(Text,font, brush, rect);
        }
    }
}
